<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/views/global/taglibs.jsp" %>
<!DOCTYPE>
<html>
<head>

<base href="<%=basePath %>">
<%@include file="/views/global/include.jsp" %>
<link href="static/css/global/generic.css" rel="stylesheet" type="text/css">
<link href="static/css/page/loginRegister.css" rel="stylesheet" type="text/css">
<title>Forget Password</title>

</head>

<body>
  	<div class="clearfix" style="height:10px;"></div>
  <div id="forgetPasswordPage" class="center"> 
  <div id="msg"></div>
  <div class="loginHeader"><div class="headerArrow center"></div></div>
  <div class="font en_M textCenter loginTitle"><b>REQUEST A PASSWORD CHANGE</b></div>
  <div class="font en_SSS subTitle">To change your password, please enter the email address currently associated with your SEAHELLO.com account</div>
  <form id="forgetPasswordForm" method="post" action="user/resetPassword">
    <div class="form-input">
    	<input id="email" name="email" type="email" class="en_M radius"  placeholder="EMAIL ADDRESS" />
    </div>
    <img id="codeImage" class="right" src="#"/>
    <div class="form-input">
    	<input id="code" name="validateCode" type="text" class="en_M radius"  placeholder="CONFIRM CODE" />
    </div>
    <div class="form-input" style="padding:0 30px;margin-bottom:20px;">
    	<a href="login" id="codeRefresh" class="en_M">Login</a>
    	<a href="javascript:void(0)" id="codeRefresh" class="en_M right" onclick="changeValidateCode()"><p>Refresh</p></a>
    </div>
    <input class="radius en_M forgetPasswordButton" type="button" onclick="resetPassword()" value="SUBMIT">
  </form>
</div>
	<%@include file="/views/global/AdminScripts.jsp" %>
</body>
<script type="text/javascript">
$(document).ready(function(){
	changeValidateCode();
});
function changeValidateCode() {
	var timenow = new Date().getTime();
	document.getElementById("codeImage").src = "<%=basePath %>validateCode?t=" + timenow;
}
function resetPassword(){
	var form = $("#forgetPasswordForm");
	var validator = $(form).validate({meta:"validate"});
	if(validator.form()){
		$(form).goAjax({semantic: false, 
			url: "/user/resetPassword",
			data:{},
			success: function(jsonData) {
				if(true == jsonData.success){
       				$("#msg").alert({type:'alert-success', text: jsonData.message});
       			} else {
       				$("#msg").alert({type:'alert-danger', text: jsonData.message});
       			}
			}
		});
	}
}
</script>
</html>
